public class CuttingRope2 {

    public static void main(String[] args) {
        CuttingRope2 cuttingRope2 = new CuttingRope2();
        System.out.println(cuttingRope2.cuttingRope(120));
    }

    static final int MOD = 1000000007;
    public int cuttingRope(int n) {
        if (n < 4) return n - 1;
        long ans = 1l;
        while (n > 4) {
            ans = ans * 3 % MOD;
            n -= 3;
        }
        return (int) (ans * n % MOD);
    }
}
